package com.guestmanage.servlet.util;

import java.util.List;

public class PageBean<T> {
	private int pageSize=20;
	private int pageNow;
	private int count;
	private int pageCount;
	private int page;
	private String url;
	private List<T> result;
	
	public PageBean(int page,int count){
		this.page=page;
		this.count=count;
		this.setPageCount(count);
		this.setPageNow(page);
	}
	
	public int getPageSize() {
		return pageSize;
	}
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}
	public int getPageNow() {
		return pageNow;
	}
	public void setPageNow(int pageNow) {
		if(page<1)
			page=1;
		if(pageCount==0)
			pageCount=1;
		if(page>pageCount)
			page=pageCount;
		this.pageNow = (page-1)*pageSize;
	}
	public int getCount() {
		return count;
	}
	public void setCount(int count) {
		this.count = count;
	}
	public int getPageCount() {
		return pageCount;
	}
	public void setPageCount(int pageCount) {
		this.pageCount =(count+pageSize-1)/pageSize;
	}
	public int getPage() {
		return page;
	}
	public void setPage(int page) {
		this.page = page;
	}
	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	public List<T> getResult() {
		return result;
	}
	public void setResult(List<T> result) {
		this.result = result;
	}
}
